package com.contract.controller;

import com.contract.pojo.input.LoginInput;
import com.contract.pojo.output.JsonResult;
import com.contract.pojo.output.LoginOutput;
import com.contract.service.LoginService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 登录controller
 *
 * @author liw
 * @version 1.0
 * @date 2022/6/23 16:34
 */
@ApiOperation("登录")
@RestController
@RequestMapping("contract/")
public class LoginController {

    @Autowired
    private LoginService loginService;

    @ApiOperation("登录")
    @PostMapping("/login")
    public JsonResult<LoginOutput> login(@RequestBody LoginInput vo) {
        return loginService.login(vo);
    }

    @ApiOperation("退出")
    @GetMapping("/logout")
    public JsonResult<Void> logout() {
        return loginService.logout();
    }

}
